package pers.zc.activiti.shujujiegou.zhan;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @description 测试list
 * @Author Lin FuYuan
 * @date 2020/5/11
 */
public class TestList {

    public static void main(String[] args) {
        TestList testList = new TestList();
        List<Demo> list = new ArrayList<>();
        list.add(new Demo("a","b","","d"));
        list.add(new Demo("a","b","","d"));
        list.add(new Demo("a","b","","d"));
        list.add(new Demo("a","b","","d"));
        list.add(new Demo("a","b","","d"));
        Map<String, Map<String, Map<String, List<Demo>>>> collect = list.stream().collect(Collectors.groupingBy(Demo::getOne, Collectors.groupingBy(Demo::getTwo, Collectors.groupingBy(Demo::getThree))));
        System.out.println(collect);

    }

    @Data
    static class Demo{
        private String one;
        private String two;
        private String three;
        private String  four;

        public Demo(String one, String two, String three, String four) {
            this.one = one;
            this.two = two;
            this.three = three;
            this.four = four;
        }

        @Override
        public String toString() {
            return "Demo{" +
                    "one='" + one + '\'' +
                    ", two='" + two + '\'' +
                    ", three='" + three + '\'' +
                    ", four='" + four + '\'' +
                    '}';
        }
    }
}
